<?php !defined("IN_SYSTEM") && exit("ACCESS DENY");?>
<?php include template('header');?>
<div id="uc_ajax">
		<?php if($action == 'add' || $action == 'edit'):?>
	<div id="createcadiv" style="display: block;border:0 none;">
						<p>类别名称：<input type="text" class="input" id="ucatename" name="ucatename" value="<?php echo $category['catename'];?>"></p>
						<p>类别名称：<input type="text" class="input" id="ucatename" name="ucatename" value="<?php echo $category['catename'];?>"></p>
						
						<input type="button" value="保存类别" onclick="useraddcates(<?php echo $category['cid'];?>);" class="button"></p>
					</div>
		<script type="text/javascript">
		function useraddcates(id){
			var name=$('#ucatename').val();
			var cstatus= $("input[name='cstatus']:checked").val();
			if(name.length<2){alert('分类名称不能少于两个字符');return false;}
			$.getJSON("home.php?f=category&a=save"+"&name="+encodeURIComponent(name)+"&cstatus="+cstatus+"&id="+id+'&tm='+Math.random(),'',function(data){
				if(data.mstatus==true){
					window.parent.location.reload();
				}else{
					alert(data.msg);
				}
				});
	
		}
		</script>
		<?php endif;?>
		<?php if($action == 'del'):?>
		<?php endif;?>

</div>

</body></html>